<?php
// +----------------------------------------------------
// | Name： 星空框架 浏览记录
// +----------------------------------------------------
// | Version: V5.0
// +----------------------------------------------------
// | Author: xkyinzhe <zhonghuaxinxing@sina.cn>
// +----------------------------------------------------
// | Time: 2021-04-27 11：34
// +----------------------------------------------------
declare(strict_types=1);

namespace app\common\model;

use think\model\concern\SoftDelete;

/**
 * @xk 浏览记录
 */
class HistoryGoods extends BaseModel
{
  use SoftDelete;
  protected $name = 'historyGoods';
  protected $pk = 'history_id';
  protected $deleteTime = 'delete_time';
  /**
   * @xk 写入前操作
   *
   * @method onBeforeWrite
   * @param  [type]                  $data                     [description]
   * @return [type]                                            [description]
   * @Author xkyinzhe                <zhonghuaxinxing@sina.cn>
   * @Time   2021-05-13T14:30:20+080
   */
  public static function onBeforeWrite($data)
  {
      unset($data['act']);
      unset($data['controllers']);
      unset($data['actions']);
      if (!$data->create_time) {
          $data->update_time = $data->create_time = date('Y-m-d H:i:s');
      }
  }
}
